package edu.corn.job.config;

import edu.corn.common.monitor.ThreadPoolFactory;
import edu.corn.job.core.engine.mutex.LocalMutexPool;
import edu.corn.job.core.engine.mutex.MutexPool;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ExecutorService;

@EnableConfigurationProperties({JobConfigProperties.class})
public class JobSupportAutoConfiguration {




    @Bean("jobMutexPool")
    public MutexPool mutexPool() {
        return new LocalMutexPool();
    }

    @Bean("jobExecutorService")
    public ExecutorService executorService() {
        return ThreadPoolFactory.createFixedThreadPool(6, "job");
    }
}
